package facilius.controller.actionmanager;

import facilius.controller.ActionManager;
import facilius.controller.action.tiponota.TipoNotaCreateAction;
import facilius.controller.action.tiponota.TipoNotaDeleteAction;
import facilius.controller.action.tiponota.TipoNotaReadAction;
import facilius.controller.action.tiponota.TipoNotaShowFormAction;
import facilius.controller.action.tiponota.TipoNotaUpdateAction;
import org.mentawai.authorization.Permission;
import org.mentawai.core.ActionConfig;
import org.mentawai.core.ApplicationManager;
import org.mentawai.core.Forward;
import org.mentawai.core.Redirect;
import org.mentawai.filter.AuthorizationFilter;

/**
 *
 * @author Graciano
 */
public class TipoNotaActionManager implements ActionManager{

    public void loadActions(ApplicationManager appManager) {
        ActionConfig ac = null;

        ac = new ActionConfig("TipoNotaRead",TipoNotaReadAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/tipoNota/tipoNotaList.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("tipoNota")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("TipoNotaShowForm",TipoNotaShowFormAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/tipoNota/tipoNotaForm.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("tipoNota")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("TipoNotaCreate", TipoNotaCreateAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("TipoNotaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("tipoNota")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("TipoNotaDelete",TipoNotaDeleteAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("TipoNotaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("tipoNota")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("TipoNotaUpdate",TipoNotaUpdateAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("TipoNotaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("tipoNota")));
        appManager.addActionConfig(ac);
    }

}
